import {Component, Input} from "@angular/core";
import {Router} from "@angular/router";
import {BarPageConfig, Navigator} from "../../domains/domains"

@Component({
  selector: "nav-bar",
  templateUrl: "navBar.component.html",
  styleUrls: ["navBar.component.css"]
})
export class NavBarComponent {
  navigators:Navigator[]=[];
  boxWidth:number;
  constructor(private router: Router,pageConfig:BarPageConfig) {
    this.navigators=pageConfig.navigators;
    this.boxWidth=20/this.navigators.length;
  }

  jump(url:string) {
      if(this.router.url==url) return;
      this.router.navigateByUrl(`${url}`);
  }
  isCurrent(navigator:Navigator){
    return this.router.url==navigator.url;
  }
}




